package com.vcredit.creditcat.service.wallet;
import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.vcredit.creditcat.dto.wallet.WalletDrawLogDto;
import com.vcredit.creditcat.model.WalletAmtLog;
import com.vcredit.creditcat.model.ext.WalletLogExt;
import com.vcredit.creditcat.persistence.WalletAmtLogExtMapper;
import com.vcredit.creditcat.persistence.base.WalletAmtLogMapper;
import com.vcredit.creditcat.util.BeanUtil;
/**
 * 
 **/
@Service
public class WalletAmtLogService {
	@Autowired
    private WalletAmtLogMapper mapper;
	
	@Autowired
    private WalletAmtLogExtMapper extMapper;
    
    public void insert(WalletAmtLog obj){
    	mapper.insert(obj);
    }
    
    public void update(WalletAmtLog obj){
    	mapper.update(obj);
    }
    
    public List<WalletAmtLog> findAll(){
		return mapper.findAll();
	}
	
	public List<WalletAmtLog> find(WalletAmtLog obj){
		return mapper.find(obj);
	}
	
	public WalletAmtLog findById(Long id){
		return mapper.findById(id);
	}

	/**
	 * 查询用户的钱包余额变更记录，倒序
	 * @author zhaoqi01
	 * @param custId
	 * @return
	 */
	public List<WalletAmtLog> findByCustIdOrderDesc(Long custId) {
		return mapper.findByCustIdOrderDesc(custId);
	}

	public List<WalletLogExt> findForWeb(WalletDrawLogDto param) {
		WalletLogExt condition = new WalletLogExt();
		BeanUtil.copy(param, condition);
		return extMapper.findForWeb(condition);
	}
	
	public BigDecimal getAccumulatedAmt(Long custId){				
		return extMapper.getAccumulatedAmt(custId);		
	}
}